<?php

namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class Card extends AmisBasics
{
    public string $type = 'card';

    /**
     * 外层 Dom 的类名
     * @param string $className
     * @return $this
     */
    public function className(string $className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 外部链接
     * @param string $href
     * @return $this
     */
    public function href(string $href)
    {
        $this->href = $href;
        return $this;
    }

    public function header(...$header)
    {

        $this->set(__FUNCTION__, ...$header);
        return $this;
    }

    /**
     * 内容容器，主要用来放置非表单项组件
     * @param  $body
     * @return $this
     */
    public function body(...$body)
    {
        $this->set(__FUNCTION__, ...$body);
        return $this;
    }

    /**
     * 内容区域类名
     * @param string $bodyClassName
     * @return $this
     */
    public function bodyClassName(string $bodyClassName)
    {
        $this->bodyClassName = $bodyClassName;
        return $this;
    }

    /**
     * 配置按钮集合
     * @param array $actions
     * @return $this
     */
    public function actions(...$actions)
    {
        $this->set(__FUNCTION__, ...$actions);
        return $this;
    }

    /**
     * 按钮集合每行个数
     * @param int $actionsCount
     * @return $this
     */
    public function actionsCount(int $actionsCount)
    {
        $this->actionsCount = $actionsCount;
        return $this;
    }

    /**
     * 点击卡片的行为
     * @param $itemAction
     * @return $this
     */
    public function itemAction($itemAction)
    {
        $this->itemAction = $itemAction;
        return $this;
    }

    /**
     * Card 多媒体部内容设置
     * @param \Amis\dataviewer\CardMedia $media
     * @return \Amis\dataviewer\CardMedia
     */
    public function media(CardMedia $media)
    {
        return $this->media = $media;
    }

    /**
     * 次要说明
     * @param $secondary
     * @return $this
     */
    public function secondary($secondary)
    {
        $this->secondary = $secondary;
        return $this;
    }

    /**
     * 工具栏按钮
     * @param array $toolbar
     * @return $this
     */
    public function toolbar(array $toolbar)
    {
        $this->toolbar = $toolbar;
        return $this;
    }

    /**
     * 是否显示拖拽图标
     * @param bool $dragging
     * @return $this
     */
    public function dragging(bool $dragging = false)
    {
        $this->dragging = $dragging;
        return $this;
    }

    /**
     * 卡片是否可选
     * @param bool $selectable
     * @return $this
     */
    public function selectable(bool $selectable = false)
    {
        $this->selectable = $selectable;
        return $this;
    }

    /**
     * 卡片选择按钮是否禁用
     * @param bool $checkable
     * @return $this
     */
    public function checkable(bool $checkable = true)
    {
        $this->checkable = $checkable;
        return $this;
    }

    /**
     * 卡片选择按钮是否选中
     * @param bool $selected
     * @return $this
     */
    public function selected(bool $selected = false)
    {
        $this->selected = $selected;
        return $this;
    }

    /**
     * 卡片选择按钮是否隐藏
     * @param bool $hideCheckToggler
     * @return $this
     */
    public function hideCheckToggler(bool $hideCheckToggler = false)
    {
        $this->hideCheckToggler = $hideCheckToggler;
        return $this;
    }

    /**
     * 卡片是否为多选
     * @param bool $multiple
     * @return $this
     */
    public function multiple(bool $multiple = false)
    {
        $this->multiple = $multiple;
        return $this;
    }
}
